package demo;

import java.util.Timer;
import java.util.TimerTask;

public class time {
    public static void main(String[] args){
        Timer timer = new Timer(); 
        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("定时器执行任务 3");
            }
        },3000);
        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("定时器执行任务 2");
            }
        },3000);
        timer.schedule(new TimerTask(){
            public void run(){
                System.out.println("定时器执行任务 1");
            }
        },3000);
        System.out.println("定时器执行任务");
    }
}
